#
# @lc app=leetcode.cn id=989 lang=python
#
# [989] 数组形式的整数加法
#

# @lc code=start
class Solution(object):
    def addToArrayForm(self, num, k):
        """
        :type num: List[int]
        :type k: int
        :rtype: List[int]
        """
        # 从最后开始遍历
        total=sum(number * 10**(len(num)-1-i) for i,number in enumerate(num) )
        total+=k
        res=[]
        while total>0:
            res.append(total%10)
            total//=10
        return res[::-1]
# @lc code=end

